#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for(register int i = (a);i <= (b);++i)
#define per(i,a,b) for(register int i = (a);i >= (b);--i) 
#define mkp std::make_pair
typedef long long ll;
typedef unsigned long long ull;
using std::string;using std::cin;using std::cout;
inline bool cmp(int x,int y){return x < y;}

const int N = 3e6+9;
const int inf = 1e9+9;
const double eps = 1e-7;
int _,n,m,top;
ll a[2*N],ans[2*N],sta[2*N][2];

int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef LOCAL //use "g++ xxx.cpp -DLOCAL"
        freopen("in.in", "r", stdin);
    #endif
    cin >> n;
    rep(i,1,n) cin >> a[i];
    sta[top++][0] = inf , sta[0][1] = 0;
    per(i,n,1){
        while(sta[top][0] <= a[i]) top--;
        ans[i] = sta[top++][1] , sta[top][0] = a[i] , sta[top][1] = i;
    }
    rep(i,1,n) cout << ans[i] << " ";

    return 0;
}